package com.cxy.api.controller;

import com.cxy.pojo.Carousel;
import com.cxy.service.CarouselService;
import com.cxy.utils.CxyJSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("index")
public class IndexController {
    @Autowired
    private CarouselService carouselService;
//    @GetMapping("/carousel/list")
//    public Object list(){
//        return carouselService.queryAll();
//    }

    @PostMapping("/carousel/list")
    public CxyJSONResult list(){
        List<Carousel> carousels = carouselService.queryAll();
        return CxyJSONResult.ok(carousels);
    }
}

